package com.qf.day06.Homework;

public class Warrior extends Hero {
    /**
     * 独有的属性，怒气值
     * <p>
     * 独有的属性，怒气值。独有的方法，英勇打击（攻击力=力量的上下百分之20*2，消耗20怒气）。
     */

    private int anger;  // 怒气值


    public void gallantAttack() {
        int y = (int) (Math.random() * (getPower() + (getPower() >= 0 ? 1 : -1)) * 0.2) * (Math.random() > 0.5 ? 1 : -1);
        System.out.println(toString() + "攻击力：" + (getPower() + y) * 2 + "怒气值：" + (anger - 20));
    }

    public Warrior() {
        super();
    }

    public Warrior(String name, int power, int intellect, int agile, int anger) {
        super(name, power, intellect, agile);
        this.anger = anger;
    }

    public int getAnger() {
        return anger;
    }

    public void setAnger(int anger) {
        this.anger = anger;
    }

    @Override
    public String toString() {
        return "Warrior{" +
                "name='" + getName() + '\'' +
                ", power=" + getPower() +
                ", intellect=" + getIntellect() +
                ", agile=" + getAgile() +
                "anger=" + anger +
                '}';
    }
}